unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, BaseGrid, AdvGrid, StdCtrls;

type
  TForm1 = class(TForm)
    ADV: TAdvStringGrid;
    Button1: TButton;
    procedure FormShow(Sender: TObject);
    procedure ADVClickCell(Sender: TObject; ARow, ACol: Integer);
    procedure ADVCanEditCell(Sender: TObject; ARow, ACol: Integer;
      var CanEdit: Boolean);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
var
  r,c:integer;
begin
  for r:=0 to adv.RowCount - 1 do
  begin
    for c:=0 to adv.ColCount -1 do
    begin
      ADV.Cells[r,c]:='Test Text';
    end;
  end;
end;

procedure TForm1.ADVClickCell(Sender: TObject; ARow, ACol: Integer);
begin
  if (ARow=1) and (ACol =1) then
    ADV.Alignments[1,1]:= taRightJustify;

end;

procedure TForm1.ADVCanEditCell(Sender: TObject; ARow, ACol: Integer;
  var CanEdit: Boolean);
begin
  CanEdit:=True;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ADV.Alignments[1,1]:= taLeftJustify;
end;

end.
